home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / rbcom341.zip / EXAMPLES.MAC < prev    next >
Text File  |  1991-04-05  |  4KB  |  124 lines

  1. ; RBcomm macro examples
  2. ;
  3. ;   by Ralf Brown
  4.  
  5. ;---------------------------------------------------------------
  6. ; beep every half hour
  7. ;   continues until another macro file is loaded or some other binding
  8. ;   issues a CANCEL_DELAYED ALL
  9. ;
  10. F2    DELAYED 1800
  11.        CALL #199      ; 200-255 are reserved
  12.  
  13. #199    MULTI
  14.     BEEP
  15.     DELAYED 1800
  16.        CALL #199
  17.      END
  18.  
  19. ; I have been asked "why CALL instead of PUSHKEY?" and "why doesn't the second
  20. ; CALL cause some kind of infinite loop?"
  21. ;
  22. ; The difference between PUSHKEY and CALL is that PUSHKEY #199 will not cause
  23. ; the #199 macro to execute until the next time RBcomm reads the keyboard at
  24. ; the terminal emulation level (it would be discarded by the line-input
  25. ; function, for example).  The CALL executes immediately and then continues
  26. ; execution with the next line of the macro (if any).  As written, the 'beep
  27. ; every half hour' macro will cause a beep even if currently executing another
  28. ; macro; with PUSHKEY, the beep would not occur until the current macro
  29. ; completes--unless the macro is/will execute a command which takes input, in
  30. ; which case the #199 will be lost, ending the repetition.  You don't get an
  31. ; infinite nesting because the DELAYED command simply stores a pointer and the
  32. ; desired time, then exits.  Thus, the macro works something like this:
  33. ;
  34. ;     create an event for CALL #199
  35. ;     exit F2
  36. ;     ...
  37. ;     time to wake up and execute the CALL #199
  38. ;         BEEP
  39. ;         create an event for CALL #199
  40. ;         exit #199
  41. ;     exit CALL #199
  42. ;     ...
  43. ;     time to wake up again and execute the CALL #199
  44. ;         BEEP
  45. ;         create an event for CALL #199
  46. ;         exit #199
  47. ;     exit CALL #199
  48. ;     ...
  49. ;     time to wake up again and execute the CALL #199
  50. ;     etc.
  51. ;
  52. ; As you can see, at any given time, there is at most one pending event and one
  53. ; invocation of #199.
  54.  
  55. ;---------------------------------------------------------------
  56. ; display a running clock in the DESQview notification window
  57. ;   continues until another macro file is loaded or some other binding
  58. ;   issues a CANCEL_DELAYED ALL
  59. ;
  60. F3    MULTI
  61.     MESSAGEBOX "%t on %d"  ; var expansion is new capability added in v3.33
  62.     DELAYED 1
  63.        CALL F3
  64.      END
  65.  
  66. ;---------------------------------------------------------------
  67. ; display a time-limited message without DESQview message-box
  68. ;    note: should be on top-most row to avoid a mess if screen scrolls during
  69. ;       wait interval
  70. ;
  71. F4    MULTI
  72.     MESSAGE 0 50 "^ATimed test message (%t)"
  73.     DELAYED 3
  74.        MESSAGE 0 50 "                             "   ; same length as orig message
  75.      END
  76.  
  77. ;---------------------------------------------------------------
  78. ; repeatedly try to elicit a response from the remote system
  79. ; abort after ten minutes of no response
  80. ;
  81. F5    MULTI
  82.     DELAYED 600
  83.        ABORT_UNTIL       ; give up after ten minutes
  84.     UNTIL SUCCESS
  85.        {
  86.        TEXT "\r"
  87.        WAITFOR 2 "login:"
  88.        }
  89.     CANCEL_DELAYED LAST  ; no more need for the timed abort
  90.      END
  91.  
  92. ;---------------------------------------------------------------
  93. ;  Set up a fancy alarm for announcing the completion of a file
  94. ;  transfer (or TYPE) or successful connection with a remote system.
  95. ;
  96. ;  If the "Alarm" pseudokey is not bound, it is equivalent to
  97. ;      Alarm  BEEP
  98. ;
  99. Alarm   REPEAT 2
  100.        {
  101.        SOUND 500 1           ; quickly rising tone
  102.        SOUND 600 1
  103.        SOUND 700 1
  104.        SOUND 800 1
  105.        SOUND 900 1
  106.        SOUND 1000 1
  107.        SOUND 0 3           ; pause briefly between repetitions
  108.        }
  109.  
  110. ;---------------------------------------------------------------
  111. ;  allow sample fancy alarm to be invoked at will
  112. ;
  113. F6    ALARM
  114.  
  115. ;---------------------------------------------------------------
  116. ; notify user of any incoming calls (only for DESQview and Hayes-comp modems)
  117. ;
  118. OnLoad    WHEN 0 "RING^M"
  119.     NOTIFY "Phone is ringing"
  120.  
  121. ;---------------------------------------------------------------
  122. ; add the standard bindings which have not been overridden
  123. #include "rbcomm"
  124.